<template>
  <a-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :md="8" :sm="24">
            <a-form-item label="课程性质" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="xzmc"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item label="是否必修" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select v-model="isCompulsory">
                <a-select-option value="0">否</a-select-option>
                <a-select-option value="1">是</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item label="是否有效" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select v-model="isAble">
                <a-select-option value="0">否</a-select-option>
                <a-select-option value="1">是</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item label="是否公共" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select v-model="isPublic">
                <a-select-option value="0">否</a-select-option>
                <a-select-option value="1">是</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>

          <a-col :md="24" :sm="24">
            <a-form-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-textarea style="width: 100%" v-model="description" />
            </a-form-item>
          </a-col>

          <a-col :md="24" :sm="24">
            <a-form-item label="创建者名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input style="width: 100%" v-model="createBy" />
            </a-form-item>
          </a-col>
        </a-row>
        <div style="text-align: center">
          <a-button @click="modalReset" type="primary" icon="reload">刷新</a-button>
        </div>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import { EduListMixin } from '@/mixins/EduListMixin'

export default {
  name: 'VeJwKcxzFilter',
  components: {},
  mixins: [EduListMixin],
  data() {
    return {
      form: this.$form.createForm(this),
      disableMixinCreated: true,
      xzmc: null,
      isCompulsory: null,
      isPublic: null,
      isAble: null,
      description: null,
      createBy: null,

      title: '操作',
      width: 1200,
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
    }
  },
  created() {},
  methods: {
    edit(record) {
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      const that = this
      //回送信息
      this.$emit('ok', this.xzmc, this.isCompulsory, this.isPublic, this.isAble, this.description, this.createBy)
      this.close()
    },
    handleCancel() {
      this.close()
    },
    //清空表单
    modalReset() {
      this.xzmc = null
      this.isCompulsory = null
      this.isPublic = null
      this.isAble = null
      this.description = null
      this.createBy = null
    },
  },
}
</script>